package com.shenmazong.servermsgapi.task;

import com.shenmazong.TbUserMessage;
import com.shenmazong.servermsgapi.mapper.TbUserMessageMapper;
import com.shenmazong.utils.ConstUtils;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
@RabbitListener(queues = ConstUtils.MQ_QUEUE_TOPIC_MSG_NANE)
public class MessageReceive {

    @Autowired
    TbUserMessageMapper tbUserMessageMapper;

    @RabbitHandler
    public void process(TbUserMessage message) {
        System.out.println("TopicManReceiver消费者收到消息  : " + message.toString());

        tbUserMessageMapper.insert(message);
    }
}
